Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Repair vaultUpgrade proposal; also register replacement scaledPriceAuthority #9748

Closed
wants to merge 5 commits into from

Conversation

Chris-Hibbert
Copy link
Contributor

@Chris-Hibbert Chris-Hibbert commented Jul 20, 2024

closes: #9584
refs: #9483

Description

We added upgrading the scaledPriceAuthority to the steps in upgrading vaults, auctions, and priceFeeds, and didn't notice that it broke things. The problem turned out to be that the "priceAuthority" object registered with the priceFeedRegistry was an ephemeral object that was not upgraded. This fixes that by re-registering the new priceAuthority.

Then, to simplify the process of cleaning up the uncollected cycles reported in #9483, we switch to replacing the scaledPriceAuthorities rather than upgrading them.

Security Considerations

N/A

Scaling Considerations

Addresses one of our biggest scaling concerns.

Documentation Considerations

None

Testing Considerations

Thorough testing in a3p.

Upgrade Considerations

See above.

@Chris-Hibbert Chris-Hibbert added contract-upgrade oracle Related to on-chain oracles. Vaults VaultFactor (née Treasury) labels Jul 20, 2024
@Chris-Hibbert Chris-Hibbert self-assigned this Jul 20, 2024
Copy link

cloudflare-workers-and-pages bot commented Jul 31, 2024

Deploying agoric-sdk with  Cloudflare Pages  Cloudflare Pages

Latest commit: 659c016
Status: ✅  Deploy successful!
Preview URL: https://d9d92eb9.agoric-sdk.pages.dev
Branch Preview URL: https://9584-upgradevaults.agoric-sdk.pages.dev

View logs

@Chris-Hibbert Chris-Hibbert requested a review from turadg July 31, 2024 20:34
Copy link
Member

@turadg turadg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Requesting changes but using Comment because I might not be around to re-review

golang/cosmos/app/upgrade.go Outdated Show resolved Hide resolved
@@ -259,7 +258,7 @@ export const makeOnewayPriceAuthorityKit = opts => {
};

/** @type {PriceAuthority} */
const priceAuthority = Far('PriceAuthority', {
const priceAuthority = Far('PriceAggregator', {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are multiple objects going by the name "priceAggregator", or being called priceAggregator, and when I see them in a debugger or trace statement, I'd like to be able to distinguish them.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It does have some appeal. PriceAuthority is an interface, and PriceAggregator is an implementation of it. Being more specific about the implementation seems reasonable... even though the argument to Far is called interface in various contexts.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wrote priceAggregator when I meant priceAuthority. The latter is the name that is overused, and the former is a name that only applies to this instance.

@@ -110,7 +110,7 @@ export const makeInitialTransform = (
: quoteP;
};

return Far('PriceAuthority', {
return Far('ScaledPriceAuthority', {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why not PriceAuthorityInitial like on the tin?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This object is the one that gets registered, and is used by many contracts. There are multiple things that are called "priceAuthority" in various places in the code (including the priceAuthorityRegistry). When I look at one of these, its extremely helpful to have its name match its purpose.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

priceAuthorityInitial is a special case for when an initialPrice is provided in the configuration. You should only see that in testing scenarios. It shouldn't show up in production. The production Far object comes from packages/zoe/src/contractSupport/priceAuthorityTransform.js. So ScaledPriceAuthorityWithInitial would make more sense here.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay, then I'll rotate the terms so the one we see in production will be ScaledPriceAuthority.

packages/zoe/src/contracts/scaledPriceAuthority.js Outdated Show resolved Hide resolved
@Chris-Hibbert Chris-Hibbert requested a review from dckc July 31, 2024 23:42
Copy link
Member

@dckc dckc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Testing ... Thorough testing in a3p.

I suppose that's in code that pre-dates this PR...

I'd like to look at the relevant sections of the ci log that show this a3p testing. Help me find it, please?


const [contractKits] = await Promise.all([
contractKitsP,
instancePrivateArgsP,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why is instancePrivateArgsP here?

for (const kitEntry of scaledPAKitEntries) {
trace({ kitEntry });

const keyword = kitEntry.label.match(/scaledPriceAuthority-(.*)/)[1];
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

relying on a label for correctness is awkward.

Did you consider filtering by installation?

I suppose you want the keyword from the label... another way to get that is from the children of published.priceAuthority... oh... but vstorage is write-only on chain. What a pain.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

relying on a label for correctness is awkward.

I agree. There seemed few enough vats at present that I could verify this produced the correct list. A slightly longer or more dynamic list and I'd have tried to find a better way.

Did you consider filtering by installation?

I didn't, but it's a good idea. Added.

@@ -259,7 +258,7 @@ export const makeOnewayPriceAuthorityKit = opts => {
};

/** @type {PriceAuthority} */
const priceAuthority = Far('PriceAuthority', {
const priceAuthority = Far('PriceAggregator', {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It does have some appeal. PriceAuthority is an interface, and PriceAggregator is an implementation of it. Being more specific about the implementation seems reasonable... even though the argument to Far is called interface in various contexts.

@@ -110,7 +110,7 @@ export const makeInitialTransform = (
: quoteP;
};

return Far('PriceAuthority', {
return Far('ScaledPriceAuthority', {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

priceAuthorityInitial is a special case for when an initialPrice is provided in the configuration. You should only see that in testing scenarios. It shouldn't show up in production. The production Far object comes from packages/zoe/src/contractSupport/priceAuthorityTransform.js. So ScaledPriceAuthorityWithInitial would make more sense here.

@Chris-Hibbert
Copy link
Contributor Author

I'd like to look at the relevant sections of the ci log that show this a3p testing. Help me find it, please?

That should be Integration tests / test-docker-build (pull_request), which says Skipped. Is there a label I can apply to get this to run?

@turadg turadg added the force:integration Force integration tests to run on PR label Aug 1, 2024
@Chris-Hibbert
Copy link
Contributor Author

@dckc The CI log you're looking for is test-docker-build. (Thanks, @turadg!)

@dckc
Copy link
Member

dckc commented Aug 7, 2024

test-docker-build has a huge log. which parts are relevant?

@Chris-Hibbert
Copy link
Contributor Author

test-docker-build has a huge log. which parts are relevant?

From my POV, the fact that it gets to upgrading after delay is crucial. That's the piece that was missed in the previous round.

  • We started new auction, priceFeed, and scaledPriceAuthority vats, and then prepared the vaults upgrade and waited
  • When the proposal noticed that prices were available, it finished upgrading vaults.
  • vat v48 upgraded from incarnation 0 to 1
  • Finally, we see "vault price updated" under Run Proposal Tests, which shows that the new vaultManager is receiving the updated prices provided via the new priceFeeds.

This PR had been trying to add stTIA, stOSMO and stkATOM to the list
of brands in A3P, to match those in mainNet, but that was a
mistake. This drops those.  It was previously adding priceFeeds,
but not scaledPriceAuthorities.
mergify bot added a commit that referenced this pull request Aug 13, 2024
closes: #9596
refs: #9748

## Description

When upgrading VaultFactory, restore the VaultDirector's parameters to the values that exist on chain.

### Security Considerations

No particular security implications.

### Scaling Considerations

Run only on upgrade. No impact.

### Documentation Considerations

No user visible impact.

### Testing Considerations

being tested manually thoroughly. The change to `typeParamManager.js` has a unit test.

### Upgrade Considerations

Make it possible to preserve values that have been updated on chain. It would have been bad to lose the updated value of `ReferencedUI`.
Copy link
Member

@dckc dckc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I plan to take a fresh look once this is in the form of a core-eval rather than chain software upgrade (for example, once upgrade.go is gone)

LMK with the re-review button plz.

@Chris-Hibbert
Copy link
Contributor Author

The changes here have been incorporated into #10074.

mergify bot added a commit that referenced this pull request Oct 9, 2024
closes: #9584
closes: #9928
refs: #9827 
refs: #9748 
refs: #9382
closes: #10031

## Description

We added upgrading the scaledPriceAuthority to the steps in upgrading vaults, auctions, and priceFeeds, and didn't notice that it broke things. The problem turned out to be that the "priceAuthority" object registered with the priceFeedRegistry was an ephemeral object that was not upgraded. This fixes that by re-registering the new priceAuthority.

Then, to simplify the process of cleaning up the uncollected cycles reported in #9483, we switched to replacing the scaledPriceAuthorities rather than upgrading them.

We also realized that we would need different coreEvals in different environments, since the Oracle addresses and particular assets vary for each (test and mainNet) chain environment.

#9748 addressed some of the issues in the original coreEval. #9999 showed what was needed for upgrading priceFeeds, which was completed by #9827.  #10021 added some details on replacing scaledPriceAuthorities.

### Security Considerations

N/A

### Scaling Considerations

Addresses one of our biggest scaling issues.

### Documentation Considerations

N/A

### Testing Considerations

Thorough testing in a3p, and our testnets.  #9886 discusses some testing to ensure Oracles will work with the upgrade.

### Upgrade Considerations

See above
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
contract-upgrade force:integration Force integration tests to run on PR oracle Related to on-chain oracles. Vaults VaultFactor (née Treasury)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Upgrading scaled price authority causes vaults upgrade to not complete
3 participants